#! /usr/bin/gforth

require params.fs

\ use CR/LF pairs to separate headers. 
: crlf 10 emit 13 emit ;
\ make the header of html files
: header  ." Content-Type: text/html " crlf crlf ;

\ outter elements define
: html ." <html>" s" </html>" cr ;
: head 2 spaces ." <head>" s" </head>" cr ;
: body 2 spaces ." <body>" s" </body>" cr ;
: /end cr 2 spaces type cr type cr ;
: .. type cr ;

\ inner elements define
: title[ ( str -- )
     '] parse
     4 spaces ." <title>" type ." </title>"  ;

: b 6 spaces ." <b>" s" </b>" ;
: h1 6 spaces ." <h1>" s" </h1>" ;
: br ." <br>" cr ;
: end> s" >" ;
\ form elements
: form cr 6 spaces  ." <form " end> ;
: action ."  action=" ;
: methold ."  methold=" ;
\ <input type=text name=姓名><br>
: input     ." <input " end> ;
: kind      ."  type=" ;
: name      ."  name=" ;
: value     ."  value=" ;
: endform cr 6 spaces ." </form>" ;

\ get parameters from links
: params s" QUERY_STRING" getenv ; 
\ simple code 


